﻿
/*----------------------------------------------------------------//
// 文件名：MoTestItem.cs
// 文件功能描述：实体 MoTestItem.
// 
// 创建标识：Template  ver 5.0.20090429 2009-11-20
//
// 修改标识：
// 修改描述：
//----------------------------------------------------------------*/
#region MoTestItem
using System;
using System.Data;
namespace EQT.Model
{
    /// <summary>
    /// 业务实体MoTestItem
    /// </summary>
    public partial class MoTestItem : ICloneable
    {
        #region 表TestItem的字段
        private string itemCode;
        private string deptId;
        private string testParameters;
        private decimal price;
        private int abilityStatus;
        #endregion

        #region 构造函数
        public MoTestItem()
        {


        }
        #endregion

        #region 拷贝构造函数

        public MoTestItem(MoTestItem item)
        {
            item.CopyTo(this);
        }
        #endregion

        #region 带参数构造函数
        public MoTestItem(string itemCode, string deptId, string testParameters, decimal price, int abilityStatus)
        {
            this.itemCode = itemCode;
            this.deptId = deptId;
            this.testParameters = testParameters;
            this.price = price;
            this.abilityStatus = abilityStatus;
        }
        #endregion

        #region 表TestItem的字段属性
        /// <summary>
        /// ITEM_CODE
        /// </summary>
        public string ItemCode
        {
            get { return itemCode; }
            set { itemCode = value; }
        }
        /// <summary>
        /// DEPT_ID
        /// </summary>
        public string DeptId
        {
            get { return deptId; }
            set { deptId = value; }
        }
        /// <summary>
        /// TEST_PARAMETERS
        /// </summary>
        public string TestParameters
        {
            get { return testParameters; }
            set { testParameters = value; }
        }
        /// <summary>
        /// PRICE
        /// </summary>
        public decimal Price
        {
            get { return price; }
            set { price = value; }
        }
        /// <summary>
        ///能力状态目前有3种：1--不可进行，2--可以进行，0--未知
        /// </summary>
        public int AbilityStatus
        {
            get { return abilityStatus; }
            set { abilityStatus = value; }
        }
        #endregion

        #region 辅助函数
        /// <summary>
        /// 拷贝函数
        /// </summary>
        public MoTestItem CopyTo(MoTestItem item)
        {
            item.itemCode = this.itemCode;
            item.deptId = this.deptId;
            item.testParameters = this.testParameters;
            item.price = this.price;
            item.abilityStatus = this.abilityStatus;
            return item;
        }
        /// <summary>
        /// 克隆函数
        /// </summary>		
        public object Clone()
        {
            MoTestItem mo = new MoTestItem();
            mo.ItemCode = this.ItemCode;
            mo.DeptId = this.DeptId;
            mo.TestParameters = this.TestParameters;
            mo.Price = this.Price;
            mo.AbilityStatus = this.AbilityStatus;
            return mo;
        }
        ///<summary>
        ///判断对象是否相等
        ///<summary>
        public override bool Equals(object obj)
        {
            if (object.ReferenceEquals(this, obj))
            {
                return true;
            }
            else
            {
                MoTestItem NewTestItem = obj as MoTestItem;
                if (NewTestItem == null)
                {
                    return false;
                }
                else
                {
                    if (NewTestItem.ItemCode == this.ItemCode && NewTestItem.DeptId == this.DeptId && NewTestItem.TestParameters == this.TestParameters && NewTestItem.Price == this.Price && NewTestItem.AbilityStatus == this.AbilityStatus)
                    {
                        return true;
                    }
                }

            }
            return false;

        }
        ///TODO:you should modify GetHashCode by yourself.
        public override int GetHashCode()
        {
            return base.GetHashCode();
        }

        public override string ToString()
        {
            return String.Format(System.Globalization.CultureInfo.InvariantCulture, "ItemCode={0}/DeptId={1}/TestParameters={2}/Price={3}/AbilityStatus={4}", itemCode, deptId, testParameters, price, abilityStatus);

        }
        #endregion


        #region DataTable Help Function
        ///<summary>
        ///DataRow转换成Model
        ///</summary>
        public void Row2Model(DataRow row)
        {
            if (row["Item_Code"] != null && row["Item_Code"] != DBNull.Value)
            {
                this.ItemCode = (string)row["Item_Code"];
            }
            else
            {
                this.ItemCode = string.Empty;
            }
            if (row["Dept_ID"] != null && row["Dept_ID"] != DBNull.Value)
            {
                this.DeptId = (string)row["Dept_ID"];
            }
            else
            {
                this.DeptId = string.Empty;
            }
            if (row["Test_Parameters"] != null && row["Test_Parameters"] != DBNull.Value)
            {
                this.TestParameters = (string)row["Test_Parameters"];
            }
            else
            {
                this.TestParameters = string.Empty;
            }
            if (row["Price"] != null && row["Price"] != DBNull.Value)
            {
                this.Price = (decimal)row["Price"];
            }
            else
            {
                this.Price = 0;
            }
            if (row["Ability_Status"] != null && row["Ability_Status"] != DBNull.Value)
            {
                this.AbilityStatus = (int)row["Ability_Status"];
            }
            else
            {
                this.AbilityStatus = 0;
            }
        }

        ///<summary>
        ///Model转换成DataRow
        ///</summary>
        public void Model2Row(DataRow row)
        {
            row["Item_Code"] = this.ItemCode;
            row["Dept_ID"] = this.DeptId;
            row["Test_Parameters"] = this.TestParameters;
            row["Price"] = this.Price;
            row["Ability_Status"] = this.AbilityStatus;
        }
        #endregion
    }
}
#endregion
